Skip to main content

How To Use Azure File Shares for a Load Balanced Environmnet

The RESTful Engine uses local storage to store the cache and requests. This is fine for a single instance, but if you want to use a load balanced system you need to setup some form of shared storage that all instances can access, so that the app can behave in a stateless manner.

This article outlines the steps you need to take to setup your Azure load balanced system with Azure File Shares. This will allow you to use a load balanced system without the need to implement your own external storage plugin.

Pre-requisites

  • In this article we are assuming that you have installed the RESTful Engine using our provided container image on an Azure App Service. This same bacic setup should work if you've installed the application using our provided WAR, but you may need to adapt the file paths slightly.

  • We reccomend testing your RESTful engine and making sure you have it installed properly before proceeding with this guide.

  • If you do not already have a Storage Account, you will need to create one. To do this, follow the instructions here.

Steps

Note: all these steps are summarized from the Azure documentation here

  1. Navigate to your storage account in the Azure portal and click on "Storage Browser" in the left hand menu.
  2. Navigate to "File Shares" and click the "+ Add File Share" button to create a new file share.
    • This is the file share that we will be mounting to our RESTful Engine.
    • You can name the file share whatever you like, but for this example we will name it appdata.
    • We reccomend using the "Transaction optimized" tier for the file share.
  3. Create two folders in your file share called requests and cache
  4. Now that you've created your file share, navigate to the App Service you have your RESTful Engine installed on.
  5. In the left hand menu, navigate to "Configuration" and click on "Path Mappings".
  6. Click the "+ New Azure Storage Path Mapping" button.
  7. Name the "Storage Mount" whatever you want.
  8. Choose your storage account from the dropdown.
  9. Set "Storage Type" to "Azure Files".
  10. Keep the "Protocol" as "SMB".
  11. Choose the file share you created earlier from the "Storage Container" dropdown.
  12. Set the "Mount Path" to /usr/local/tomcat/webapps/App_Data.
  13. Click "Add" followed by "Save". Your path mapping should now be set up.
  14. Stop your App Service and start it again. This will apply the path mapping to your App Service.
    • Restart should work, but in our testing stopping and starting the service was more reliable.